<?php
session_start();
require_once("../models/Payment.php");
class AddPaymentController{

	var $paymentDetails;
	function sendData(){
		$this->paymentDetails['unit'] = $_REQUEST['unit'];
		$this->paymentDetails['amount'] = $_REQUEST['amount'];
		$this->paymentDetails['mode'] = $_REQUEST['mode'];
		$this->paymentDetails['date_received'] = $_REQUEST['date_received'];
		$this->paymentDetails['receipt_no'] = $_REQUEST['receipt_no'];
	}
}

	$a = new AddPaymentController;
	$a->sendData();
	
	$payment = new Payment;
	$payment->connect();
	$payment->addPayment($a->paymentDetails);
	echo "You have successfully added payment for Unit ".$_REQUEST['unit']." amounting to P".$_REQUEST['amount'].".";
?>